package com.example.origin.finance.trade.dto.impl;

import com.example.origin.finance.trade.dto.Analyst;
import com.example.origin.finance.trade.dto.Conclusion;
import com.example.origin.finance.trade.dto.InfoResource;
import com.example.origin.finance.trade.enums.Action;

public class BlueAnalyst extends Analyst {
    @Override
    protected Conclusion conclusion() {
        InfoResource infoResource = getInfoResource();
        return new Conclusion(infoResource, klineFlag() ? Action.BUY : Action.SELL);
    }

    public boolean klineFlag() {
        if (getKline().getPe() == null || getKline().getMarket_capital() == null) {
            return false;
        }
        if (getKline().getPe() >= 10 && getKline().getPe() <= 35) {
            if (getKline().getMarket_capital() >= 1E9 && getKline().getMarket_capital() <= 2E10) {
                return true;
            }
        }
        return false;
    }
}
